{extend name="public/base"/}
{block name="body"}
<style>
	.table-responsive{min-height:600px;}
	</style>

<div class="main-box no-header clearfix">
	<header class="main-box-header clearfix">
		<div class="pull-left">
			<ul class="nav nav-tabs">
				<li class="active">
					<a href="{:url('index')}">{$meta_title}</a>
				</li>
				<li >
					<a href="{:url('index_tree')}">树形版</a>
				</li>
			</ul>
		</div>

		{if session('user_auth.group')!=4&&session('user_auth.group')!=3}
		<div class="pull-right">
			<a href="{:url('add')}" class="btn btn-primary pull-right"> <i class="fa fa-plus-circle fa-lg"></i> 新增员工</a>
		</div>
		{/if}
	</header>
	<div class="main-box-body clearfix">
	<div class="row">
			<form method="get">
				<div class="col-sm-12 col-md-3">
					<input type="text" class="form-control" name="keyword" value="{$keyword|default=''}" placeholder="请输入关键字">
				</div>
				{if session('user_auth.group')!=4&&session('user_auth.group')!=3}
				<div class="col-sm-12 col-md-3">
					<select name="group" id="group" class="form-control">
						<option value="">请选择部门</option>
						{foreach name="grouplist" item="vo" key="k" }
							<option value="{$k}" {if $group==$k}selected {/if}>{$vo}</option>
						{/foreach}
					</select>
				</div>
				{/if}
				<div class="col-sm-12 col-md-3">
					<button class="btn btn-primary" type="submit">搜索</button>
				</div>
			</form>
		</div>
		<div class="table-responsive">
			<table class="table user-list table-hover">
				<thead>
					<tr>
						<th>
							<span>ID</span>
						</th>
						<th>
							<span>员工姓名</span>
						</th>
						<th>
							<span>手机号码</span>
						</th>
						<th>
							<span>授权部门</span>
						</th>
						<th>
							<span>我的下级</span>
						</th>
						<th>
							<span>我的上级</span>
						</th>
						<th>
							<span>岗位</span>
						</th>
						<th>
							<span>等级</span>
						</th>
						<th>
							<span>创建时间</span>
						</th>
						<th class="text-center">
							<span>状态</span>
						</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					{volist name="list" id="item"}
					<tr>
						<td>{$item['uid']}</td>
						<td>
							<a href="{:url('index/user/index')}?authoruid={$item['uid']}" target="_blank">{$item['uid']|get_nickname}</a>
						</td>
						<td>
							<span >{if $item['mobile']}{$item['mobile']}{else/}--{/if}</span>
						</td>
						<td>
						{$grouplist[$item['group']]}
						</td>
						<td>
							下级
						</td>

						<td>{$members[$item['pid']]|default='超级管理员'}</td>

						<td>{$item['situation']}</td>
						<td>{$item['gradation']}</td>

						<td>{$item['reg_time']|date='Y-m-d',###}</td>


						<td class="text-center">
							{if condition="$item['status']"}
							<span class="label label-primary">启用</span>
							{else/}
							<span class="label label-danger">禁用</span>
							{/if}
						</td>
						<td>
							<a href="{:url('User/edit',array('id'=>$item['uid']))}" class="table-link"><i class="fa fa-edit"></i>编辑</a>
							<a class="openDilog" href="javascript:;" url="{:url('User/authWindow',array('id'=>$item['uid']))}"><i class="fa fa-male"></i>授权</a>
							<a href="{:url('User/del',array('id'=>$item['uid']))}" class="confirm ajax-get"><i class="fa fa-remove"></i>删除
							<!--<a href="{:url('User/autologin',array('id'=>$item['uid']))}" class="table-link"><i class="fa fa-user"></i>自动登录-->
							<!--<span class="label label-primary"><a style="color:#f5f5f5" class="openDilog" href="javascript:;" url="{:url('User/authWindow',array('id'=>$item['uid']))}">授权</a></span>-->
							<!--
							<div class="btn-group">
							<button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">
									更多 <span class="caret"></span>
							</button>
								<ul class="dropdown-menu dropdown-menu-right">

								   <li><a href="{:url('User/edit',array('id'=>$item['uid']))}" class="table-link"><i class="fa fa-edit"></i>编辑</a></li>

								{if session('user_auth.group')!=4&&session('user_auth.group')!=3}
								{if $item['group']!=999}
									<li><a href="{:url('User/auth',array('id'=>$item['uid']))}" class="table-link"><i class="fa fa-male"></i>授权
									</a></li>
									<li><a href="{:url('User/del',array('id'=>$item['uid']))}" class="confirm ajax-get"><i class="fa fa-remove"></i>删除
									</a>
									</li>
								{/if}
								{/if}
								{if $item['group']==4 || $item['group']==3}
									<li><a href="{:url('User/autologin',array('id'=>$item['uid']))}" class="table-link"><i class="fa fa-user"></i>自动登录
									</a></li>
								{/if}
									
								</ul>
							</div>
							-->
							
						</td>
					</tr>
					{/volist}
				</tbody>
			</table>
			{$page}
		</div>
	</div>
</div>
<script type="text/javascript" src="__PUBLIC__/plugs/layer/layer.js"></script>
<script type="text/javascript">
	$(function(){
		$('.openDilog').click(function(){
			layer.open({
				type: 2,
				title: false,
				area: ['90%', '80%'],
				content: $(this).attr('url')+"&_menu=hide&page=1"
			});
		});
	})
</script>

{/block}